import { forwardRef, Ref, useImperativeHandle, useState } from "react"

import TimeRangePicker from "@/components/business/formItems/common/timeRangePicker"
// import { Select } from "antd"
import ComplexInput from "@/components/common/complexInput"
import { useLocale } from "@/locales"
// import dynamicComponent from "./dynamicImport"

const ComplexBetTime = (props: any, ref: Ref<unknown> | undefined) => {
	const { newFormat } = useLocale()
	const options = [
		{ label: newFormat({ id: "label.bet.createAt" }), value: "create" },
		{ label: newFormat({ id: "label.bet.checkAt" }), value: "check" }
	]
	if (props.isReset) options.push({ label: newFormat({ id: "label.bet.resetTime" }), value: "reset" })
	const [field, setField] = useState("create")
	useImperativeHandle(ref, () => {
		return {
			setField,
			field
		}
	})
	return (
		<ComplexInput options={options} value={field} onTypeChange={setField}>
			<TimeRangePicker noLabel />
		</ComplexInput>
	)
}

export default forwardRef(ComplexBetTime)
